package com.ysh.smartplatform.controller.swagger;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;


/**
 * 袁胜虎 on 2022/9/15 16:54
 */
@EnableSwagger2
@Configuration
public class SwaggerConfig {
    @Bean
    public Docket api(ApiInfo apiInfo) {
        return new Docket(DocumentationType.SWAGGER_2)
                .select()
//                .apis(RequestHandlerSelectors.any())
                .apis(RequestHandlerSelectors.basePackage("com.ysh.smartplatform.controller"))
                .build()
                .apiInfo(apiInfo);
    }
    @Bean
    public ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("智能设备管理项目接口文档")
                .description("智能设备管理项目接口测试")
                .version("1.0.0")
                .termsOfServiceUrl("")
                .license("Apache2.0")
                .licenseUrl("http://httpd.apache.org/docs/2.0/license.html")
                .build();
    }
}
